package com.smxy.mall.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "fat_goods")
@Data
public class Goods {
    @Id //主键Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;  //id 自动生成
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime; //创建时间
    @LastModifiedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime; //更新时间
    @CreatedBy
    private String createUser; //创建者
    @LastModifiedBy
    private String updateUser; //更新者

    private Integer categoryId;
    @Column(name = "goodsName")
    private String goodsName; //商品名
    @Column(name = "cover")
    private String cover; //商品图片
    @Column(name = "price",scale = 2)
    private Double price; //商品价格
    @Column(name = "linePrice",scale = 2)
    private Double linePrice; //划线价
    @Column(name = "imgs")
    private String imgs; //轮播图
    @Column(name = "num")
    private int num; //库存
    @Column(name = "detail")
    private String detail; //商品详情
    @Column(name = "info")
    private String info; //商品介绍
}
